<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
            补充一个知识点，Object.getPrototypeOf()可以拿到参数的构造函数的prototype，其实也就是参数的__proto__
                    function Person(){}
                    let p = new Person();
                    console.log(Object.getPrototypeOf(p) == Person.prototype);
        */
        function instance(left, right) {
            let a = Object.getPrototypeOf(left);
            let b = right.prototype;

            while (1) {
                // 如果找到头了都没找到，那就return false
                if (!a) {
                    return false;
                }
                // 如果一样了就return true
                if (a === b) {
                    return true;
                }
                // 循环把a赋值为它的__proto__
                a = Object.getPrototypeOf(a);
            }


        }
        console.log(instance(1, Number));


    </script>
</body>

</html>